package com.nas.crocus.convert;

import javax.annotation.PostConstruct;

import org.codehaus.jackson.map.DeserializationConfig;
import org.codehaus.jackson.map.ObjectMapper;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;

@Component("customObjectMapper")
public class CustomObjectMapper extends ObjectMapper {
    private static final Logger logger = LoggerFactory.getLogger(CustomObjectMapper.class);
    
    @PostConstruct
    public void afterPropertiesSet() throws Exception {
        logger.debug("Configurando!!!");
        //super.configure(DeserializationConfig.Feature.FAIL_ON_UNKNOWN_PROPERTIES, false);        
        DeserializationConfig deserializationConfig = super.getDeserializationConfig();
        deserializationConfig.set(DeserializationConfig.Feature.FAIL_ON_UNKNOWN_PROPERTIES, false);
        this.setDeserializationConfig(deserializationConfig);
        logger.debug("habilitado" + this.getDeserializationConfig().isEnabled(DeserializationConfig.Feature.FAIL_ON_UNKNOWN_PROPERTIES));
    }    
    
    
}
